package com.curd.common.config.exception;

import org.springframework.http.HttpStatus;

public class CloudException extends AbstractException {

    private HttpStatus httpStatus;

    public CloudException(String message) {
        super(message);
        this.httpStatus = HttpStatus.INTERNAL_SERVER_ERROR;
    }

    public CloudException(String message, HttpStatus httpStatus) {
        super(message);
        this.httpStatus = httpStatus;
    }

    public CloudException(String message, Throwable cause) {
        super(message, cause);
    }

    @Override
    public HttpStatus getStatus() {
        return this.httpStatus == null ? HttpStatus.INTERNAL_SERVER_ERROR : this.httpStatus;
    }

    public Integer getCode(){
        return this.httpStatus.value();
    }
}
